【 MATLAB 】norm ( Vector and matrix norms )(向量范数以及矩阵范数)

您所在的位置:网站首页 error norms翻译 【 MATLAB 】norm ( Vector and matrix norms )(向量范数以及矩阵范数)

【 MATLAB 】norm ( Vector and matrix norms )(向量范数以及矩阵范数)

2023-09-10 21:16| 来源: 网络整理| 查看: 265

norm

Vector and matrix norms

Syntax

n = norm(v)

n = norm(v,p)

n = norm(X)

n = norm(X,p)

n = norm(X,'fro')

Description

n = norm(v)返回向量v的欧几里德范数。该范数也称为2范数,向量幅度或欧几里德长度。

n = norm(v,p)返回广义向量p范数。

n = norm(X)返回矩阵X的2范数或最大奇异值,其近似为max(svd(X))。

n = norm(X,p)返回矩阵X的p范数,其中p为1,2或Inf:

如果p = 1,则n是矩阵的最大绝对列和。

如果p = 2,则n近似为max(svd(X))。 这相当于norm(X)。

如果p = Inf,那么n是矩阵的最大绝对行和。

n = norm(X,'fro')返回矩阵X的Frobenius范数。

有关范数的基础知识,见博文:【 MATLAB 】范数的必备基础知识

下面举例说明:

Vector Magnitude(向量幅度) %Create a vector and calculate the magnitude. v = [1 -2 3]; n = norm(v) % n = 3.7417 1-Norm of Vector clc clear close all % Calculate the 1-norm of a vector, which is the sum of the element magnitudes. X = [-2 3 -1]; n = norm(X,1) % n = 6 Euclidean Distance Between Two Points clc clear close all % Calculate the distance between two points as the norm of the difference between the vector elements. % % Create two vectors representing the (x,y) coordinates for two points on the Euclidean plane. a = [0 3]; b = [-2 1]; % Use norm to calculate the distance between the points. d = norm(b-a)

d =

    2.8284 几何上,两点之间的距离:

2-Norm of Matrix clc clear close all % Calculate the 2-norm of a matrix, which is the largest singular value. X = [2 0 1;-1 1 0;-3 3 0]; n = norm(X) % n = 4.7234 Frobenius Norm of Sparse Matrix clc clear close all % 使用'fro'计算稀疏矩阵的Frobenius范数,该范数计算列向量的2范数S(:)。 S = sparse(1:25,1:25,1); n = norm(S,'fro') % n = 5

 

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3